/**
 * 
 */
package edu.rice.test.simple;

import java.util.ArrayList;

/**
 * @author frogy
 *
 */
public class MultithreadMain {
	public static void main(String[] args){
		MultithreadRead mr = new MultithreadRead(10);
		Numbers[] a = new Numbers[2];
		a[0] = new Numbers(10,mr);
		a[1] = new Numbers(-1,mr);
		Thread[] workers = new Thread[2];
		for (int threadn = 0; threadn < 2; threadn++) {
			workers[threadn] = new Thread(new Worker(a[threadn]));
			workers[threadn].start();
		}
		for (int threadn = 0; threadn < 2; threadn++) {
			try {
				workers[threadn].join();
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		System.out.println("Neighbors of " + a[0].a);
		for(int i = 0; i < a[0].al.size(); i++){
			System.out.print(a[0].al.get(i) + " ");
		}
		System.out.println();
		System.out.println("-----------------------");
		System.out.println("Neighbors of " + a[1].a);
		for(int i = 0; i < a[1].al.size(); i++){
			System.out.print(a[1].al.get(i)+ " ");
		}
		System.out.println();	
	}
}